
//var baseurl='http://www.quanzhong.com';
var baseurl='https://admin.huidianshang.com';

//登录-密码验证
function passwordInputCheck(password){
    var reg = /^[\S]{6,12}$/;
    if(password==null || password==""){
        var worn = '<span class="worn" style="position: absolute;top: 9px;right: 10px;color: #ec0707;">登录密码不能为空</span>'
        $("input[name='password']").after(worn).css("border-color","#f00");
        return false;
    } else if(!reg.test(password)){
        var worn = '<span class="worn"  style="position: absolute;top: 9px;right: 10px;color: #ec0707;">密码必须6到12位</span>'
        $("input[name='password']").after(worn).css("border-color","#f00");
        return false;
    }else{
        $('.worn').remove();
        $("input[name='password']").css("border-color","rgb(230, 230, 230)");
        return true;
    }
}
//修改密码-新密码
function newpwdInputCheck(newpwd){
    var reg = /^[\S]{6,12}$/;
    if(newpwd==null || newpwd==""){
        var worn = '<span class="worn" style="position: absolute;top: 9px;right: 10px;color: #ec0707;">原密码不能为空</span>'
        $("input[name='newpwd']").after(worn).css("border-color","#f00");
        return false;
    } else if(!reg.test(newpwd)){
        var worn = '<span class="worn"  style="position: absolute;top: 9px;right: 10px;color: #ec0707;">密码必须6到12位</span>'
        $("input[name='newpwd']").after(worn).css("border-color","#f00");
        return false;
    }else{
        $('.worn').remove();
        $("input[name='newpwd']").css("border-color","rgb(230, 230, 230)");
        return true;
    }
}
//修改密码-再次密码
function newsecondpwdInputCheck(newsecondpwd){
    if (newsecondpwd == null || newsecondpwd == "") {
        var worn = '<span class="worn" style="position: absolute;top: 11px;right: 10px;color: #ec0707;">确认密码不能为空</span>'
        $("input[name='newsecondpwd']").after(worn).css("border-color", "#f00");
        return false;
    } else if (newsecondpwd != $("input[name='newpwd']").val()) {
        $('.worn').remove();
        $("input[name='newsecondpwd']").val("");
        var worn = '<span class="worn" style="position: absolute;top: 11px;right: 10px;color: #ec0707;">两次输入密码不一致</span>'
        $("input[name='newsecondpwd']").after(worn).css("border-color", "#f00");
        return false;
    } else {
        $('.worn').remove();
        $("input[name='newsecondpwd']").css("border-color", "rgb(230, 230, 230)");
        return true;
    }
}

function getCookie(name)
{
    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
    if(arr=document.cookie.match(reg))
        return unescape(arr[2]);
    else
        return null;
}

function setCookie(name,value)
{
    var Days = 30;
    var exp = new Date();
    exp.setTime(exp.getTime() + Days*24*60*60*1000);
    document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}

function delCookie(name)
{
    var exp = new Date();
    exp.setTime(exp.getTime() - 1);
    var cval=getCookie(name);
    if(cval!=null)
        document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}




